package com.czkt.springboot_mybatis_test.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.czkt.springboot_mybatis_test.entity.CstCustomer;
import com.czkt.springboot_mybatis_test.entity.vo.CstCustomerBasDict;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2024-06-18
 */
@Mapper
public interface CstCustomerMapper extends BaseMapper<CstCustomer> {
    @Select("select count(*) from bas_dict b,cst_customer c where b.dict_value = c.cust_region and c.cust_name like concat('%',#{custName},'%')  and c.cust_region like concat('%',#{custRegion},'%')")
    Integer cusTomerBasCount(@Param("custName")String custName,@Param("custRegion")String custRegion);

    @Select("select * from bas_dict b,cst_customer c where b.dict_value = c.cust_region and c.cust_name like concat('%',#{custName},'%')  and c.cust_region like concat('%',#{custRegion},'%')  LIMIT #{pageIndex},#{pageSize}")
    List<CstCustomerBasDict> cusTomerBas(@Param("custName")String custName,@Param("custRegion")String custRegion,@Param("pageIndex")Integer pageIndex,@Param("pageSize") Integer pageSize);

}
